<template>
	<view class="content">
		<my-top :url="this.url" :topName="topName" :userName="userName"></my-top>
		<view class="indexContent">
			<head-title :titleHead="titleHead"  :btnFont="btnFont" ></head-title>
		<!-- 	<view class="dormitoryNav">
				<view style="font-weight: 800;font-size: 42rpx;">全部信息
					<view class="leaveLine" ></view>
				</view>
			</view> -->
			<view v-if="instructorHisList.length>0" style="margin-top:-40rpx">
				<view v-for="(item,index) in instructorHisList" :key="index" @click="detailDvFun(item)">
					<view class="mainContentWrap">
						<view style="margin-top:35rpx;color:#0000FF;font-weight: 800;font-size: 30rpx;width:150rpx">
							<span style="font-size: 30rpx;margin-right:40rpx;color:#0000FF"></span>  
							{{item.studentName}}
						</view>
						<view style="margin-top:38rpx;color:#8F8F94;font-size:28rpx;width:120rpx">{{item.className}}</view>
						<view style="margin-top:26rpx;color:#8F8F94;font-size:28rpx;width:300rpx;width:180rpx">{{item.patrolTime}}</view>
						<view style="margin-top:40rpx;color:#ff0088;font-size: 30rpx;width:190rpx;text-align: right;flex-wrap: nowrap;margin-right: 40rpx;">
							
						{{item.type}}  
						</view>
					</view>
				</view>
				<view class="repDevice" v-if="loadMore">没有更多数据了</view> 
			</view>		
			<view v-else class="repDevice">暂无违纪记录</view>
		</view>
		<!-- <my-bottom :topName="topName" :bottomArr="attendanceArr" :bottomName="bottomName"></my-bottom>		 -->
	</view>
</template>

<script>
	import topCom from '@/pages/component/topCom.vue'
	import bottomCom from '@/pages/component/bottom.vue'
	import headTitle from '@/pages/component/btnHeadeCom.vue'
	export default {
		name:'leveRegistration',
		data(){
			return{
				url:"/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex",
				btnFont:"入校登记",
				loadMore:false,
				isShowTitle:true,
				isShowList:false,
				userName:'',
				topName:'入校巡查',
				titleHead:'记录列表',
				bottomName:'home',
				instructorHisList:[],
				attendanceArr:[ {
				    name:'home',
				    icon:'iconfont icon-yonghutongji',
				    text:"违纪",
				    path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
				},
				{
				    name:'atttendance',
				    icon:'iconfont icon-bi',
				    text:"统计",
				    path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
				},
				{
				    name:'maintenance',
				    icon:'iconfont icon-shezhi',
				    text:"设置",
				    path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
				}],
				schoolDv:[{
					id:1,
					title:"着装",
					isShow:false,
				},{
					id:2,
					title:"睡觉",
					isShow:false,
				},{
					id:3,
					title:"玩游戏",
					isShow:false,
				},{
					id:4,
					isShow:false,
					title:"外出"
				},{
					id:5,
					isShow:false,
					title:"抽烟"
				},{
					id:7,
					title:"迟到",
					isShow:false,
				},{
					id:8,
					title:"未戴校牌",
					isShow:false,
				},{
					id:9,
					title:"未穿校服",
					isShow:false,
				},{
					id:10,
					title:"携带外卖",
					isShow:false,
				},{
					id:11,
					title:"校园抽烟",
					isShow:false,
				},{
					id:12,
					title:"打架斗殴",
					isShow:false,
				},{
					id:13,
					title:"饮酒酗酒",
					isShow:false,
				},{
					id:14,
					title:"打牌赌博",
					isShow:false,
				},{
					id:15,
					title:"翻爬围墙",
					isShow:false,
				},{
					id:16,
					title:"谩骂他人",
					isShow:false,
				},{
					id:17,
					title:"携带违禁品",
					isShow:false,
				},{
					id:18,
					title:"宿舍抽烟",
					isShow:false,
				},{
					id:6,
					title:"其他",
					isShow:false,
				},],
				roleName:'',
				pageSize:10,
				pageNum:1,
				total:0,
			}
		},
		components:{
			topCom,
			bottomCom,
			headTitle,
		},
		mounted(){
			this.getSchoolPatrolPageList()
		},
		onShow() {
			var that = this
			uni.getStorage({
				key:'userInfo',
				success(res) {
					that.userName = res.data
				}
			})
			uni.getStorage({
				key:'loginName',
				success:(res)=>{
					that.roleName = res.data
				}
			})
		},
		onReachBottom() {
			    if(this.total >=this.pageNum*this.pageSize){
					this.pageNum++
					this.getSchoolPatrolPageList()
					
				}else{
					this.loadMore = true
				}		
				
		},
		methods:{
			//  1:宿舍巡查 2:入校早操巡查 3:课堂巡查 4:午休巡查 5:晚自习巡查'
			getSchoolPatrolPageList() {
				this.$api.duty.getSchoolPatrolPageList(2, this.pageSize, this.pageNum).then(res => {
					this.total = res.data.total
					this.instructorHisList = this.instructorHisList.concat(res.data.list)
					this.instructorHisList.forEach((item, index) => {
						for(var i =0;i<this.instructorHisList.length;i++){
							for(var j=0;j<this.schoolDv.length;j++){
								if(this.instructorHisList[i].dvType == this.schoolDv[j].id){
									this.instructorHisList[i].type = this.schoolDv[j].title
								}
							}
						}
					})
				})
			},
		 detailDvFun(item){
			 // uni.setStorage({
			 // 	key:"dutyDetail",
				// data:item
			 // })
			 // uni.setStorageSync("dutyDetail",item)
			 var str = JSON.stringify(item);
			 uni.navigateTo({
			 	url:`/pages_main/dutyCheckWorkAttendance/dutySchoolDetail?str=${str}`
			 })
		 },
			
		}
	}
</script>

<style>
	.repDevice{
		text-align: center;
		font-size: 32rpx;
		color:#808080;
		margin-top:50rpx;
	}
	.mainContentWrap{
		border:#8F8F94 solid 0rpx;
		height: 120rpx;
		border-radius: 20rpx;
		margin-top:30rpx;
		width:680rpx;
		margin-left:22rpx;
		box-shadow: 0upx 0upx 10upx 0upx #8F8F94;
		display: flex;
		justify-content: space-around;
		align-content: space-around;
		
	}
	.dormitoryNav{
				color:#0000FF;
				margin-left:80rpx;
				margin-top: 30rpx;		
			}
			.leaveLine{
				width:200upx;
				height:8upx;
				background:rgba(239, 220, 11, 1.0);
				opacity:0.78;
				position: relative;
				bottom: -10rpx;
				left:-30upx;
			}
	.attBtn1{
		margin-right:4rpx;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-top:-20rpx;		
	}
	.leaveNav{
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: row;
		font-size: 36upx;
		color:blue;
		width:100%;
		padding:50upx
	}
	.leaveBtn{
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/tubiao-01.png);
		background-size: 100%;
		width:190upx;
		height:60upx;
		color:white;
		font-size: 26upx;
		font-weight: 0;
	}
	.leaveLine{
		width:200upx;
		height:8upx;
		background:rgba(239, 220, 11, 1.0);
		opacity:0.78;
		position: relative;
		bottom: -10upx;
		left:-30upx;
	}
	.leaveMgm{
		color:#808080;
		font-size: 28upx;
	}
	.leaveCheck{
		margin-left:60upx;
		margin-bottom: 30upx;
		
	}
	.attBtnFontSlec{
		border:solid #007AFF !important ;border-radius: 15upx;font-size: 20upx;
		color:white;
		background-color: #007AFF;
	}
	.attBtnFont{
		border:solid #808080 0rpx !important;;font-size: 20upx;
	}
	.attBtnFont1{
		border:solid #808080 0rpx !important;;font-size: 20upx;
		padding-left: 18rpx !important;
		padding-right: 18rpx !important;
	}
	.attLine{
		width:700upx;
		height:3upx;
		background:rgba(239, 237, 236, 1.0);
		opacity:0.78;
		position: relative;
		bottom: 10upx;
		left:0upx;
	}
	.attBtn{
		width:60%;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-top:-20upx;
		
	}
	.leaveBtn{
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/tubiao-01.png);
		width:190upx;
		height:60upx;
		color:white;
		font-size: 26upx;
		font-weight: 0;
	}
	.leaveLine{
		width:220upx;
		height:8upx;
		background:rgba(239, 220, 11, 1.0);
		opacity:0.78;
		position: relative;
		bottom: -10rpx;
		left:-30upx;
	}
	.leaveMgm{
		color:#808080;
		font-size: 28upx;
	}
	.leaveCheck{
		margin-left:60upx;
		margin-bottom: 30upx;		
	}
	.checkout{
		display: flex;
		justify-content: space-around;
		align-content: space-between;
	}
	.leaveTabLine{
		width:3upx;
		height:60upx;
		background:#8F8F94;
		opacity:0.78;
		position: relative;
		top: 0upx;
		left:150upx;
	}
	.indexContent{
		height: unset !important
	}
</style>
